import Vue from "vue";
import Vuex from "vuex";
import VuexPersistence from "vuex-persist";

const vuexLocal = new VuexPersistence({
  Storage: window.localStorage,
});
Vue.use(Vuex);
const store = new Vuex.Store({
  // 公共状态
  state: {
    // 导航栏头部
    color: "",
    // 主体颜色
    bodycolor: "",
    name: "123",
    abcList: [

    ],
    abcnum: ''
  },
  mutations: {
    checked(state, finds) {
      // console.log(finds);
      state.abcList.splice(finds, 1);
    },
    setColor(state, payload) {
      state.color = payload;
    },
    setBodyColor(state, payload) {
      state.bodycolor = payload;
    },
    setAbcnum(state, payload) {
      state.abcnum = payload;
    },
    setAbcList(state, payload) {
      // console.log(state.abcList)
      state.abcList.push(payload)
    },
  },
  getters: {},
  // plugins: [vuexLocal.plugin],
  plugins: [vuexLocal.plugin],
});

export default store;
